package com.example.evensystem.view

import android.app.DatePickerDialog
import android.content.Context
import android.util.Log
import android.widget.Toast
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable

import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.example.evensystem.model.entity.Account
import com.example.evensystem.model.entity.DailyWork
import com.example.evensystem.model.entity.MonthPlan
import com.example.evensystem.model.entity.MonthlyWork
import com.example.evensystem.model.entity.Worker
import com.example.evensystem.ui.theme.EvenSystemTheme
import com.example.evensystem.utils.DateUtils
import com.example.evensystem.viewmodel.CheckStatus
import com.example.evensystem.viewmodel.MainViewModel
import com.example.evensystem.viewmodel.PlanButtonStatus
import java.text.SimpleDateFormat
import java.util.Date


@Preview
@Composable
fun preview() {
    EvenSystemTheme {
        // WorkManagePage()
        // WorkerListPage(list =)
        //AddAccoutList()
        //AccoutListPage(list = listOf(Account("001", "123"), Account("002", "123")))
    }
}

//选择入口
@Composable
fun ChoicePage(modifier: Modifier, navController: NavController) {
    Column(
        modifier = Modifier.fillMaxSize(),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {

        Text(
            text = "考勤管理系统", style = MaterialTheme.typography.headlineLarge
        )
        Spacer(modifier = modifier.height(50.dp))
        //员工端
        Button(onClick = { navController.navigate("login") }) {
            Text(text = "进入员工端", fontSize = 25.sp)
            Modifier.fillMaxSize()
        }
        Spacer(modifier = modifier.height(15.dp))
        Button(onClick = { navController.navigate("managechoice") }) {
            Text(text = "进入管理端", fontSize = 25.sp)
            Modifier.fillMaxSize()
        }
    }
}

//管理员端菜单
@Composable
fun ManagerPage(navController: NavController) {
    Column(
        modifier = Modifier.fillMaxSize(),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {

        Text(
            text = "管理员", style = MaterialTheme.typography.headlineLarge
        )
        Spacer(modifier = Modifier.height(50.dp))
        //员工端
        Button(onClick = { navController.navigate("workerlist") }) {
            Text(text = "查看员工工作状况", fontSize = 25.sp)
            Modifier.fillMaxSize()
        }
        Spacer(modifier = Modifier.height(15.dp))
        Button(onClick = { navController.navigate("accountlist") }) {
            Text(text = "管理员工账户", fontSize = 25.sp)
            Modifier.fillMaxSize()
        }
        Spacer(modifier = Modifier.height(15.dp))
        Button(onClick = { navController.navigate("workManage") }) {
            Text(text = "进行工作安排", fontSize = 25.sp)
            Modifier.fillMaxSize()
        }
    }
}

//账户列表
@Composable
fun AccoutListPage(
    list: SnapshotStateList<Account>,
    navController: NavController,
    viewModel: MainViewModel
) {

    Column(
        Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        LazyColumn(
            Modifier
                .fillMaxWidth()
                .weight(2f)
        ) {
            item {
                Column(
                    Modifier
                        .fillMaxWidth()
                        .weight(2f)
                ) {
                    for (i in 0..list.size - 1) {
                        AccountItem(text = "${list.get(i).id}(密码：${list.get(i).passwd})",
                            onDelete = {
                                val worker = viewModel.findWorker(list.get(i).id)
                                if (worker != null) {
                                    viewModel.deleteWorker(worker)
                                }
                                viewModel.deleteAccount(list.get(i))
                                list.remove(list.get(i))
                            })
                    }
                }
            }
        }
        Button(onClick = { navController.navigate("addAccount") }) {
            Text(text = "增加账户")
        }
    }
}


//增加账户列表
@Composable
fun AddAccoutList(
    navController: NavController,
    viewModel: MainViewModel,
    context: Context,
    list: SnapshotStateList<Account>
) {
    Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {
        val id = remember {
            mutableStateOf("")
        }
        val passwd = remember {
            mutableStateOf("")
        }
        val name = remember {
            mutableStateOf("")
        }
        val year = remember {
            mutableStateOf("")
        }
        val sex = remember {
            mutableStateOf("")
        }
        val job = remember {
            mutableStateOf("")
        }
        EditText(text = "工号", value = id.value, onValueChaned = { id.value = it })
        EditText(text = "密码", value = passwd.value, onValueChaned = { passwd.value = it })
        EditText(text = "姓名", value = name.value, onValueChaned = { name.value = it })
        EditText(text = "入职年份", value = year.value, onValueChaned = { year.value = it })
        EditText(text = "性别", value = sex.value, onValueChaned = { sex.value = it })
        EditText(text = "职位", value = job.value, onValueChaned = { job.value = it })

        Spacer(modifier = Modifier.weight(1f))
        Button(onClick = {
            if (id.value == "" || passwd.value == "") {
                Toast.makeText(context, "工号和密码不得为空", Toast.LENGTH_SHORT).show()
                return@Button
            }
            val ssex = when (sex.value) {
                "男" -> 1
                "女" -> 0
                else -> {
                    Toast.makeText(context, "性别输入不规范", Toast.LENGTH_SHORT).show()
                    return@Button
                }
            }
            val newWorker = Worker(id.value, name.value, year.value, job = job.value)
            val newAccount = Account(id.value, passwd.value)
            viewModel.insertWorker(newWorker)
            viewModel.insertAccount(newAccount)
            list.add(newAccount)
            Toast.makeText(context, "添加成功", Toast.LENGTH_SHORT).show()

        }) {
            Text(text = "保存")
        }

    }
}


//账户item
@Composable
fun AccountItem(text: String, onDelete: () -> Unit) {
    Row(
        Modifier
            .fillMaxWidth()
            .padding(5.dp)
            .background(Color(0xFFEFB8C8)),
        verticalAlignment = Alignment.CenterVertically
    ) {
        Text(
            textAlign = TextAlign.Center,
            modifier = Modifier.weight(1f),
            text = text,
            style = MaterialTheme.typography.bodyMedium
        )
        Button(onClick = { onDelete() }) {
            Text(text = "删除")
        }
    }

}


//员工列表
@Composable
fun WorkerListPage(list: List<Worker>, navController: NavController, viewModel: MainViewModel) {
    Column(
        Modifier
            .fillMaxWidth()
            .height(500.dp)
    ) {
        for (i in 0..list.size - 1) {
            WorkerItem(text = "${list.get(i).name}(${list.get(i).id})",
                navController,
                {
                    viewModel.editIdFind(list.get(i).id)
                    navController.navigate("checkWork")
                })
        }
    }
}

@Composable
fun WorkerItem(text: String, navController: NavController, onClick: () -> Unit) {
    Row(
        Modifier
            .fillMaxWidth()
            .padding(5.dp)
            .clickable { onClick() }, Arrangement.Center
    ) {
        Text(text = text, style = MaterialTheme.typography.bodyMedium)
    }
}

@Composable
fun checkWorkPage(
    onSearchedD: (String) -> Unit, onSearchedM: (String, String) -> Unit,
    viewModel: MainViewModel
) {
    Column(Modifier.fillMaxSize()) {
        DailyWorkPage(
            onSearched = onSearchedD,
            viewModel = viewModel,

            )

        MonthlyWorkPage(
            onSearched = onSearchedM,
            viewModel = viewModel
        )
    }
}

//输入框
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EditText(text: String, value: String, onValueChaned: (String) -> Unit) {
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .padding(5.dp),
        Arrangement.End,
        Alignment.CenterVertically
    ) {
        Text(text = "$text：", style = MaterialTheme.typography.bodyMedium)
        TextField(value = value, onValueChange = onValueChaned)
    }
}

//设置工作安排
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WorkManagePage(viewModel: MainViewModel, context: Context) {
    val today = Date()

    //获取本月工作安排
    val monthW = remember {
        mutableStateOf(DateUtils.formMonth(today))
    }
    var monthplan = viewModel.findMonthPlan(monthW.value)
    var indays = "23"
    var inAT = "9:00:00"
    var inLT = "17:00:00"
    var instaus = PlanButtonStatus.NOT
    if (monthplan!=null) {
        monthW.value = monthplan.month.toString()
        indays = monthplan.workDays.toString()
        inAT = monthplan.arriveTime
        inLT = monthplan.leftTime
        instaus = PlanButtonStatus.ALREADY
    }

    val days = remember {
        mutableStateOf(indays)
    }
    val arriveTime = remember {
        mutableStateOf(inAT)
    }

    val leftTime = remember {
        mutableStateOf(inLT)
    }

    val status = remember {
        mutableStateOf(instaus)
    }



    Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.Start) {
        Spacer(modifier = Modifier.height(66.dp))
        Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.End) {
            Row(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(5.dp),
                Arrangement.End,
                Alignment.CenterVertically
            ) {
                Text(
                    text = "月份:${monthW.value}         ",
                    style = MaterialTheme.typography.bodyMedium
                )

                Button(onClick = {
                    val dp = DatePickerDialog(context)
                    dp.setOnDateSetListener(DatePickerDialog.OnDateSetListener(fun(
                        DatePicker,
                        year: Int,
                        month: Int,
                        Days: Int
                    ) {
                        if (month < 10) {
                            monthW.value = "$year-0${month + 1}"
                        } else {
                            monthW.value = "$year-${month + 1}"
                        }
                        val monthplan = viewModel.findMonthPlan(monthW.value)
                        if (monthplan!=null) {
                            days.value = monthplan.workDays.toString()
                            arriveTime.value = monthplan.arriveTime
                            leftTime.value = monthplan.leftTime
                            status.value = PlanButtonStatus.ALREADY
                        } else {
                            days.value = "23"
                            arriveTime.value = "9:00:00"
                            leftTime.value = "17:00:00"
                            status.value = PlanButtonStatus.NOT
                        }

                    }))
                    dp.show()

                }, Modifier.padding(10.dp)) {
                    Text(text = "选择月份")
                }
            }
            EditText(text = "工作天数", value = "${days.value}", onValueChaned = {
                if (status.value == PlanButtonStatus.NOT) {
                    val filteredText = it.replace(Regex("[^0-9]"), "")
                    days.value = filteredText
                }

            })
            EditText(
                text = "上班时间",
                value = arriveTime.value,
                onValueChaned = {
                    if (status.value == PlanButtonStatus.NOT) {
                        arriveTime.value = it
                    }
                })
            EditText(
                text = "下班时间",
                value = leftTime.value,
                onValueChaned = {
                    if (status.value == PlanButtonStatus.NOT) {
                        leftTime.value = it
                    }
                })

        }
        Spacer(modifier = Modifier.height(66.dp))
        Row(
            Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.Center
        ) {
            Button(enabled = when (status.value) {
                PlanButtonStatus.NOT -> true
                PlanButtonStatus.ALREADY -> false
            },
                onClick = {
                    //查询格式是否正确
                    val num = days.value.toInt()
                    if (num > DateUtils.getdaysOfMonth(monthW.value) || num <= 0) {
                        Toast.makeText(context, "工作天数输入错误", Toast.LENGTH_SHORT).show()
                        return@Button
                    }
                    try {
                        val simpleDateFormat = SimpleDateFormat("HH:mm:ss")
                        simpleDateFormat.parse(arriveTime.value)
                        simpleDateFormat.parse(leftTime.value)
                    } catch (e: Exception) {
                        e.printStackTrace()
                        Toast.makeText(context, "时间输入错误", Toast.LENGTH_SHORT).show()
                        return@Button
                    }
                    //排除错误后保存
                    val mp =
                        MonthPlan(monthW.value, arriveTime.value, leftTime.value, 0, num)
                    viewModel.insertMonthPlan(mp)
                    status.value = PlanButtonStatus.ALREADY
                }) {
                Text(text = "保存工作安排")
            }
        }

    }


}

fun datePick(context: Context) {
    val dp = DatePickerDialog(context)
    dp.setOnDateSetListener(DatePickerDialog.OnDateSetListener(fun(
        DatePicker,
        year: Int,
        month: Int,
        days: Int
    ) {

    }))
    dp.show()


}

//登陆页面
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3Api::class)
@Composable
fun LoginPage(
    modifier: Modifier = Modifier,
    viewModel: MainViewModel,
    navController: NavController,
    context: Context
) {
    val id by viewModel.id_login.observeAsState("")
    val passwd by viewModel.passwd_login.observeAsState("")
    Column(modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center) {
        Row(
            modifier = Modifier
                .fillMaxWidth()
                .padding(horizontal = 10.dp),
            Arrangement.Center,
            Alignment.CenterVertically
        ) {
            Text(text = "工号：")
            TextField(value = id, onValueChange = { viewModel.editId(it) })
        }
        Spacer(modifier = Modifier.height(10.dp))
        Row(
            modifier = Modifier
                .fillMaxWidth()
                .padding(horizontal = 10.dp),
            Arrangement.Center,
            Alignment.CenterVertically
        ) {
            Text(text = "密码：")
            TextField(value = passwd, onValueChange = { viewModel.editPasswd(it) })
        }
        Spacer(modifier = Modifier.height(20.dp))
        Row(Modifier.fillMaxWidth(), Arrangement.Center) {
            Button(modifier = Modifier.padding(5.dp),
                onClick = {
                    //查找工号对应的账户

                    val account = viewModel.findAccount(id)
                    if (account == null) {
                        Toast.makeText(context, "账户不存在", Toast.LENGTH_SHORT).show()
                        return@Button
                    }
                    if (!account.passwd.equals(passwd)) {
                        Toast.makeText(context, "密码不正确", Toast.LENGTH_SHORT).show()
                        return@Button
                    }
                    viewModel.editIdFind(id)
                    navController.navigate("check")
                }
            ) {
                Text(text = "登录")

            }
        }


    }


}

//考勤页面
@Composable
fun CheckPage(
    viewModel: MainViewModel,
    navController: NavController
) {
    val date = DateUtils.formDate(Date())
    val month = DateUtils.formMonth(Date())
    val arriveTime by viewModel.arrivedTime.observeAsState("")
    val leftTime by viewModel.leftTime.observeAsState("")
    //查找数据库中有无date的记录判断初始状态
    var initial = CheckStatus.NOT_ARRIVED
    val id = viewModel.id_login.value
    if (id == null) return

    val dailyWork = viewModel.findDW(id, date)

    if (dailyWork != null) {
        if (!dailyWork.arriveTime.equals("")) {
            initial = CheckStatus.ARRIVED
            Log.d("TAG", "CheckPage: $initial")
            viewModel.editArrivedTime(dailyWork.arriveTime)
            if (!dailyWork.leaveTime.equals("")) {
                initial = CheckStatus.LEFT
                Log.d("TAG", "CheckPage: $initial")
                viewModel.editLeftTime(dailyWork.leaveTime)
            }
        }
    } else {
        viewModel.editArrivedTime("")
        viewModel.editLeftTime("")
    }
    val status by viewModel.checkStatus.observeAsState(initial)
    viewModel.editCheckStatus(initial)

    Log.d("TAG", "CheckPage: $status")
    //查询本月安排
    var monthManage = viewModel.findMonthPlan(month)
    //如果没有就摁插一个朝九晚五双休的安排
    if (monthManage == null) {
        val mp = MonthPlan(month, "09:00:00", "17:00:00", 8, 23)
        viewModel.insertMonthPlan(mp)
        monthManage = viewModel.findMonthPlan(month)
    }
    if (monthManage == null) {
        return
    }

    var isLate = false
    var isEarly = false



    Column(
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier.fillMaxSize()
    ) {
        Text(
            text = SimpleDateFormat("yyyy年MM月dd日").format(Date()),
            style = MaterialTheme.typography.headlineMedium,
        )
        Button(
            modifier = Modifier
                .fillMaxWidth()
                .padding(20.dp), shape = CircleShape,
            onClick = {
                //查找月总结
                val monthWorkL = viewModel.findMW(id, date)
                if (monthWorkL == null) {
                    val monthWork = MonthlyWork(month, id, 0, 0, monthManage.workDays, 0)
                    viewModel.insertMW(monthWork)
                }
                val monthWork = viewModel.findMW(id, date)
                if (monthWork == null) {
                    return@Button
                }
                //上班打卡
                if (status == CheckStatus.NOT_ARRIVED) {
                    //更新日总结
                    viewModel.editArrivedNowTime()
                    //判断是否迟到
                    if (arriveTime > monthManage.arriveTime) {
                        isLate = true
                    }
                    val dw = DailyWork(date, id, arriveTime, "", isLate, false)
                    viewModel.insertDW(dw)
                    //更新月总结
                    if (isLate) {
                        monthWork.lateTimes++//迟到次数+1
                    }
                    if (monthWork != null) {
                        viewModel.insertMW(monthWork)
                    }
                    viewModel.editCheckStatus(CheckStatus.ARRIVED)
                } else if (status == CheckStatus.ARRIVED) {
                    //更新日总结
                    viewModel.editLeftNowTime()
                    //判断是否早退
                    if (leftTime < monthManage.leftTime) {
                        isEarly = true
                    }
                    val dw = DailyWork(date, id, arriveTime, leftTime, isLate, isEarly)
                    viewModel.insertDW(dw)
                    //更新月总结
                    if (isEarly) {
                        monthWork.leftEarlyTimes += 1//早退次数+1
                    }
                    monthWork.workedDates += 1//已工作天数+1
                    monthWork.leftDates -= 1//剩余天数-1
                    if (monthWork != null) {
                        viewModel.insertMW(monthWork)
                    }
                    viewModel.editCheckStatus(CheckStatus.LEFT)
                }

            }, enabled = (status != CheckStatus.LEFT)
        ) {
            Text(
                text = when (status) {
                    CheckStatus.NOT_ARRIVED -> "上班打卡"
                    CheckStatus.ARRIVED -> "下班打卡"
                    CheckStatus.LEFT -> "已下班"
                }, style = MaterialTheme.typography.headlineLarge
            )
        }

        Text(
            text = "上班时间：" + arriveTime,
            modifier = if (status == CheckStatus.NOT_ARRIVED) {
                Modifier
                    .height(0.dp)
                    .align(Alignment.CenterHorizontally)
            } else {
                Modifier
                    .fillMaxWidth()
                    .align(Alignment.CenterHorizontally)
            }
        )
        Text(
            text = "下班时间：" + leftTime,
            modifier = if (status == CheckStatus.LEFT) {
                Modifier
                    .fillMaxWidth()
                    .align(Alignment.CenterHorizontally)
            } else {
                Modifier
                    .height(0.dp)
                    .align(Alignment.CenterHorizontally)
            }
        )

        Spacer(modifier = Modifier.height(20.dp))

        Row {
            Button(onClick = { navController.navigate("dailyWork") }) {
                Text(text = "查看日总结状况")
            }

            Button(onClick = { navController.navigate("monthlyWork") }) {
                Text(text = "查看月总结状况")
            }
        }
    }
}


//查询日总结
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DailyWorkPage(
    onSearched: (String) -> Unit,
    viewModel: MainViewModel,
) {

    val today = DateUtils.formDate(Date())
    val dateSearch by viewModel.dateDW.observeAsState(initial = today)

    val dailyWork = viewModel.idFind.value?.let { viewModel.findDW(it, today) }
    val worker = viewModel.idFind.value?.let { viewModel.findWorker(it) }


    var initialAT = ""
    var initialLT = ""

    //viewModel.dateDW.observeForever(onSearched)
    dailyWork?.let {
        initialAT = it.arriveTime
        initialLT = it.leaveTime
    }


    val arrivedTime by viewModel.arrivedTimeDW.observeAsState(initialAT)
    val leftTime by viewModel.leftTimeDW.observeAsState(initialLT)
    Column(Modifier.fillMaxWidth()) {
        Spacer(modifier = Modifier.height(20.dp))
        Row(Modifier.padding(10.dp)) {
            TextField(
                modifier = Modifier.width(200.dp),
                value = dateSearch,
                onValueChange = { viewModel.editdateDW(it) })
            Button(onClick = { onSearched(dateSearch) }, Modifier.padding(5.dp)) {
                Text(text = "查询")
            }
        }
        Spacer(modifier = Modifier.height(20.dp))
        Column(
            Modifier.fillMaxWidth(),

            ) {
            Text(
                text = "工号：${worker?.id}\n姓名：${worker?.name}",
                style = MaterialTheme.typography.titleMedium
            )
            Text(
                text = "上班时间：$arrivedTime\n下班时间：$leftTime",
                style = MaterialTheme.typography.titleMedium
            )

        }
    }
    Log.d(
        "TAG", "DailyWorkPage:上班时间：${viewModel.arrivedTimeDW.value} " +
                "下班时间：${viewModel.leftTimeDW.value} "
    )
}

//查询月总结
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MonthlyWorkPage(
    onSearched: (id: String, month: String) -> Unit,
    viewModel: MainViewModel
) {
    val id = viewModel.idFind.value
    if (id == null) return
    val thisMonth = DateUtils.formMonth(Date())
    val month by viewModel.monthMW.observeAsState(thisMonth)
    val worker = viewModel.idFind.value?.let { viewModel.findWorker(it) }
    var lt = -1
    var et = -1
    var wd = -1
    var ld = -1


    val monthwork = viewModel.findMW(id, thisMonth)
    if (monthwork != null) {
        lt = monthwork.lateTimes
        et = monthwork.leftEarlyTimes
        wd = monthwork.workedDates
        ld = monthwork.leftDates
    }

    val lateT by viewModel.lateTimeMW.observeAsState(lt)
    val earlyT by viewModel.earlyTimeMW.observeAsState(et)
    val workedD by viewModel.workedDaysMW.observeAsState(wd)
    val leftD by viewModel.leftDaysMW.observeAsState(ld)
    Column(modifier = Modifier.fillMaxWidth()) {
        Spacer(modifier = Modifier.height(20.dp))
        Row(Modifier.padding(10.dp)) {
            TextField(
                value = month,
                onValueChange = { viewModel.editMonthMW(it) },
                modifier = Modifier.width(200.dp)
            )
            Button(onClick = { onSearched(id, month) }, Modifier.padding(5.dp)) {
                Text(text = "查询")
            }
        }
        Spacer(modifier = Modifier.height(20.dp))
        Column {
            Text(
                text = "迟到次数：$lateT\n早退次数：$earlyT\n已工作天数：$workedD\n剩余天数：$leftD",
                style = MaterialTheme.typography.titleMedium
            )
        }
    }

}
